package com.project2.myjunit;


import com.project2.myjunit.annotions.*;
import com.project2.testJunit4.Calculation;

//单元测试类
public class TestCalculator {

    static Calculation js;  //待测试的功能单元

    //@Test执行前一定运行构造函数
    public TestCalculator(){
        System.out.println( "CalculationTest的构造方法[生命周期]");
    }


    @MyBeforeClass  //在单元测试开始前执行,
    public static void beforeClass(){
        System.out.println("beforeClass()");
        js=new Calculation();
    }

    @MyBeforeClass
    public static void beforeClass2(){
        System.out.println("beforeClass2()");
        js=new Calculation();
    }

    @MyBefore
    public void before(){
        System.out.println( "before()");
    }

    @MyBefore
    public void before2(){
        System.out.println( "before2()");
    }

    @MyTest
    public void testAdd(){
        System.out.println(  "testAdd()加法测试 ");
        //Assert.assertEquals(7, js.add(3,4)  );
    }

    @MyTest
    public void testSub(){
        System.out.println("testSub()减法测试");
       // Assert.assertEquals(-1, js.sub(3,4)  );
    }

    @MyIgnore
    public void testIgnore(){
        System.out.println("ignore()");
    }

    @MyAfter
    public void after(){
        System.out.println("after");
    }

    @MyAfterClass
    public static void afterClass(){
        System.out.println("afterclass");
    }
}
